Skip to main content

All Questions

1vote
2answers
187views

Select nth smallest distinct integer from inputs

Kata in question Given a list of integers, return the nth smallest integer in the list. Only distinct elements should be considered when calculating the answer. n will always be positive (n > 0) ...
Tobi Alafin's user avatar
5votes
2answers
3kviews

Hackerrank "Almost Equal" solution

I've spent the best part of a day on this question. It is marked as Expert level. There are about fifteen submission test cases and my solution manages to satisfy the first four. However, from there ...
Mark Mc Adam's user avatar
1vote
1answer
344views

Verify that each named sequence is strictly increasing

The master launch sequence consists of several independent sequences for different systems. Your goal is to verify that all the individual system sequences are in strictly increasing order. In other ...
JRowan's user avatar
6votes
2answers
3kviews

Minimum swaps algorithm terminated due to timeout

I have been trying to solve this question. Given an unordered array consisting of consecutive integers [1, 2, 3, …, n], find the minimum number of two-element swaps to sort the array. I was able ...
Ugur Yilmaz's user avatar
3votes
1answer
1kviews

Sorting a 2-dimensional array with counting sort

The task I'm solving is: Sort a list by its keys Print out the corresponding values on one line separated by whitespace Replace the values of the first half of the input to "-" Use Counting Sort The ...
hooni's user avatar
4votes
1answer
1kviews

Repeated comparison of sorted subarrays

This question is from a recently concluded competition on Codechef. You are given an array A of size n, and there are ...
Ravi Chandra's user avatar
3votes
1answer
690views

SPOJ GENERAL: sorting by swaps of distance k

I have been trying to solve this simple problem on SPOJ for quite some time now, but I keep on getting TLE (Time limit exceeded) for some reason. Since the problem is in Portuguese, a brief ...
user007's user avatar

close